#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;


int t, n, a[MAXN], b[MAXN];
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    
    cin>>t;
    while(t--){
        cin>>n;
        for(int i=1;i<=n;i++) cin>>a[i];

        if (n%2==0) {
            for (int i=1,j=2;j<=n;i+=2,j+=2)
                cout << -a[j] << ' ' << a[i] << ' ';
            cout << endl;
        } else {
            int x = a[1], y = a[2], z = a[3];
            if (x + y != 0) {
                cout << -z << ' ' << -z << ' ' << x+y << ' ';
            } else if (x+z != 0) {
                cout << -y << ' ' << x+z << ' ' << -y << ' ';
            } else if (y+z != 0) {
                cout << y+z << ' ' << -x << ' ' << -x << ' ';
            }

            for (int i=4,j=5;j<=n;i+=2,j+=2)
                cout << -a[j] << ' ' << a[i] << ' ';
            cout << endl;
        }
    }
    return 0;
}